/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.EmbeddedId;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.UniqueConstraint;
/**
 *
 * @author Elias Mendoza
 */
@Entity
@Table(name="producto_sustrato",uniqueConstraints={@UniqueConstraint(columnNames={"id_producto","id_sustrato"})})
public class ProductoSustrato implements Serializable{
  @Id
  private int id;
  @Column(name="fila_surco",nullable=false)
  private int filaSurco;
  @Column(name="coor_a_x")
  private float coordenadaAX;
  @Column(name="coor_a_y")
  private float coordenadaAY;
  @Column(name="coor_b_x")
  private float coordenadaBX;
  @Column(name="coor_b_y")
  private float coordenadaBY;
  
  @JoinColumn(name="id_producto", referencedColumnName="id",nullable=false)
  @ManyToOne()
  private Producto productoFK;
  @JoinColumn(name="id_sustrato", referencedColumnName="id",nullable=false)
  @ManyToOne()
  private Sustrato sustratoFK;

  public ProductoSustrato() {
  }

  public float getCoordenadaAX() {
    return coordenadaAX;
  }

  public void setCoordenadaAX(float coordenadaAX) {
    this.coordenadaAX = coordenadaAX;
  }

  public float getCoordenadaAY() {
    return coordenadaAY;
  }

  public void setCoordenadaAY(float coordenadaAY) {
    this.coordenadaAY = coordenadaAY;
  }

  public float getCoordenadaBX() {
    return coordenadaBX;
  }

  public void setCoordenadaBX(float coordenadaBX) {
    this.coordenadaBX = coordenadaBX;
  }

  public float getCoordenadaBY() {
    return coordenadaBY;
  }

  public void setCoordenadaBY(float coordenadaBY) {
    this.coordenadaBY = coordenadaBY;
  }

  public int getFilaSurco() {
    return filaSurco;
  }

  public void setFilaSurco(int filaSurco) {
    this.filaSurco = filaSurco;
  }

  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  public Sustrato getSustratoFK() {
    return sustratoFK;
  }

  public void setSustratoFK(Sustrato sustratoFK) {
    this.sustratoFK = sustratoFK;
  }

  public Producto getProductoFK() {
    return productoFK;
  }

  public void setProductoFK(Producto productoFK) {
    this.productoFK = productoFK;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    final ProductoSustrato other = (ProductoSustrato) obj;
    if (this.id != other.id) {
      return false;
    }
    if (this.sustratoFK != other.sustratoFK && (this.sustratoFK == null || !this.sustratoFK.equals(other.sustratoFK))) {
      return false;
    }
    if (this.productoFK != other.productoFK && (this.productoFK == null || !this.productoFK.equals(other.productoFK))) {
      return false;
    }
    return true;
  }

  @Override
  public int hashCode() {
    int hash = 7;
    hash = 23 * hash + this.id;
    hash = 23 * hash + (this.sustratoFK != null ? this.sustratoFK.hashCode() : 0);
    hash = 23 * hash + (this.productoFK != null ? this.productoFK.hashCode() : 0);
    return hash;
  }

  
  
}
